﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using TaskScheduler;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建者
            var creator = "Tonge";
            //计划任务名称
            var taskName = "CalcTask";
            //执行的程序路径
            var path = "C:\\Windows\\System32\\shutdown.exe";
         
            //计划任务执行的频率 PT1M一分钟  PT1H30M 90分钟
            //var interval = "PT1M";
            //开始时间 请遵循 yyyy-MM-ddTHH:mm:ss 格式
            var startBoundary = "2015-04-09T01:40:00";
            var description = "this is description";
            var arg1 = "-f -s -t 0";
            var sec1 = "W";
          //  _TASK_STATE state = SchTaskExt.CreateTaskScheduler(creator, taskName, path, arg1, interval, startBoundary, description, sec1);
            _TASK_STATE state = SchTaskExt.CreateTaskScheduler(creator, taskName, path, arg1, startBoundary, description, sec1);
            if (state == 0)
             //   if (state == _TASK_STATE.TASK_STATE_RUNNING)
            {
              //  MessageBox.Show("计划任务部署成功!");
            }
        }




    }
}
